<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 数字 </title>
</head>
<body>
<h2>Infinity</h2>
<p>Infinity （或 -Infinity）是 JavaScript 在计算数时超出最大可能数范围时返回的值。</p>

<p id="demo"></p>

<script>
  var myNumber = 2;
  var txt = "";
  while (myNumber != Infinity) {
    myNumber = myNumber * myNumber;
    txt = txt + myNumber + "<br>";
  }
  document.getElementById("demo").innerHTML = txt;
</script>

</body>
</html>


</body>
</html>

<!--
运行结果：
4
16
256
65536
4294967296
18446744073709552000
3.402823669209385e+38
1.157920892373162e+77
1.3407807929942597e+154
Infinity
-->

<!--
1.除以 0（零）也会生成 Infinity   x =  2 / 0;y = -2 / 0; // x 将是 Infinity；y 将是 -Infinity
2.Infinity 是数：typeOf Infinity 返回 number。
-->